package com.xdap.common.pojo.dto;


public class DataResponse<T>  {

    private T data;
    private String code;
    private String message;

    public DataResponse() {
    }

    public DataResponse(String code, String message) {
        this.code=code;
        this.message=message;
    }

    public static DataResponse ok() {
        return new DataResponse();
    }

    public static <T> DataResponse ok(T t) {
        return ok().data(t);
    }

    public DataResponse data(T data) {
        this.data = data;
        return this;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static DataResponse error(String message) {
        return new DataResponse("error", message);
    }
}
